

import 'package:basic_common/common_exports.dart';

import 'model/my_presc_list_data.dart';

class MyPrescListController extends GetxController {
  final presclistData = <MyPrescListData>[].obs;
  final prescSttaus = ''.obs;

  /// 获取处方列表
  void getPrescList() async {
    HttpData res =
        await ApiService().getPrescList(data: {"status": "2", "scene": "1"});
    if (res.code == 1) {
      MyPrescDataList list = MyPrescDataList.fromJson(res.data);
      if (list.total! > 0) {
        presclistData.value = list.list!;
      }
      update(['prescList']);
    }
  }

  String  showText(int index) {
    String status="";
    switch (index) {
      case 0:
      status = '已开方';
        break;
      case 1:
       status = '未开方';
        break;
      case 2:
      status = '待审核';
      case 3:
      status = '已审核';
        break;
    }
    return status;
  }

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    getPrescList();
  }
}
